using System;
using System.ComponentModel;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using WindowsPhoneMVC.Phone.Interfaces;

namespace WindowsPhoneMVC.Tests.Navigation.Fakes
{
    public class FakeShell : IShell
    {
        private readonly IMvcFrame mvcFrame;

        public FakeShell(IMvcFrame mvcFrame)
        {
            this.mvcFrame = mvcFrame;
        }

        public object FindName(string name)
        {
            return mvcFrame;
        }

        public event EventHandler<CancelEventArgs> BackKeyPress;

        public void SetApplicationBar(IApplicationBar applicationBar)
        {
        }

        public SupportedPageOrientation SupportedOrientations { get; set; }

        public void OnBackKeyPress(CancelEventArgs e)
        {
            var handler = BackKeyPress;
            if (handler != null) handler(this, e);
        }
    }
}